package com.chuantou.yuba.api.to;

import java.util.ArrayList;
import java.util.List;

import android.os.Parcel;

import com.google.gson.annotations.SerializedName;

/**
 * 资讯列表TO
 * 
 * @author Administrator
 * 
 */
public class NewsListTO extends BaseTO {
	// 当前页码
	@SerializedName("p")
	private int currentPage;
	// 广告位列表，只有第一页才会返回
	@SerializedName("digest")
	private List<NewsAdTO> adList;
	// 资讯列表
	@SerializedName("news")
	private List<NewsTO> newsList;

	public NewsListTO() {
	}

	public NewsListTO(Parcel source) {
		super(source);
		this.currentPage = source.readInt();
		this.adList = new ArrayList<NewsAdTO>();
		source.readTypedList(this.adList, NewsAdTO.CREATOR);
		this.newsList = new ArrayList<NewsTO>();
		source.readTypedList(this.newsList, NewsTO.CREATOR);
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		super.writeToParcel(dest, flags);
		dest.writeInt(currentPage);
		dest.writeTypedList(this.adList);
		dest.writeTypedList(this.newsList);
	}

	public static final Creator<NewsListTO> CREATOR = new Creator<NewsListTO>() {

		@Override
		public NewsListTO[] newArray(int size) {
			return new NewsListTO[size];
		}

		@Override
		public NewsListTO createFromParcel(Parcel source) {
			return new NewsListTO(source);
		}
	};

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public List<NewsAdTO> getAdList() {
		return adList;
	}

	public void setAdList(List<NewsAdTO> adList) {
		this.adList = adList;
	}

	public List<NewsTO> getNewsList() {
		return newsList;
	}

	public void setNewsList(List<NewsTO> newsList) {
		this.newsList = newsList;
	}

}
